THE ULTIMATE PYTHON HANDBOOK by harry code with

THE ULTIMATE PYTHON HANDBOOK by harry code with

Author:harry, code with
Language: eng
Format: epub
Publisher: UNKNOWN
Published: 2024-07-11T00:00:00+00:00


CHAPTER 6 – CONDITIONAL EXPRESSION

Sometimes we want to play PUBG on our phone if the day is Sunday.

Sometimes we order Ice Cream online if the day is sunny.

Sometimes we go hiking if our parents allow.

All these are decisions which depend on a condition being met.

In python programming too, we must be able to execute instructions on a condition(s) being met.

This is what conditionals are for!

IF ELSE AND ELIF IN PYTHON

If else and elif statements are a multiway decision taken by our program due to certain conditions in our code.

Syntax:

if (condition1): # if condition1 is True

print ("yes")

elif(condition2): # if condition2 is True

print("no")

else: # otherwise

print("maybe")



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.